********************************************************************************
* Name			: Table A.1 - Balance, parent background
*
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

foreach v of varlist age0 age1 educ0 educ1 educ_diff selfemp0 selfemp1 {
reg `v' t2 t3 t4, robust
test t2=t3=t4
}

********************************************************************************
* Name			: Table A.2 - Balance, child background
*
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

foreach v of varlist gender_child_chosen std_child_chosen childrenprimary child_tot ///
 school2 school3 school4 {
reg `v' t2 t3 t4, robust
test t2=t3=t4
}

********************************************************************************
* Name			: Table A.3 - Balance, parent preferences
*
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

foreach v of varlist time_3weeks_share0 time_3weeks_share1 time  ///
 risk_invest_share0 risk_invest_share1 risk {
reg `v' t2 t3 t4, robust
test t2=t3=t4
}

********************************************************************************
* Name			: Table A.4 - Heterogeneity in time-and risk preference difference,
*                 and gender of the child, with test of equality of treatment coefficients
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_child_nogender std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk
global diff_parent_notime educ_diff risk
global diff_parent_norisk educ_diff time 

reg dist_child time t2 t3 t4 t2Xtime t3Xtime t4Xtime $bg_child $bg_parent $diff_parent_notime i.session, robust
lincom t2 + t2Xtime
lincom t3 + t3Xtime
lincom t4 + t4Xtime 
test t2=t3
test t2=t4
test t3=t4
test t2+t2Xtime=t3+t3Xtime
test t2+t2Xtime=t4+t4Xtime
test t3+t3Xtime=t4+t4Xtime

*Column (2)
reg dist_child risk t2 t3 t4 t2Xrisk t3Xrisk t4Xrisk $bg_child $bg_parent $diff_parent_norisk i.session, robust
lincom t2 + t2Xrisk
lincom t3 + t3Xrisk
lincom t4 + t4Xrisk
test t2=t3
test t2=t4
test t3=t4
test t2+t2Xrisk=t3+t3Xrisk
test t2+t2Xrisk=t4+t4Xrisk
test t3+t3Xrisk=t4+t4Xrisk

*Column (3)
reg dist_child gender_child_chosen t2 t3 t4 t2Xmale t3Xmale t4Xmale $bg_child_nogender $bg_parent $diff_parent i.session, robust
lincom t2 + t2Xmale
lincom t3 + t3Xmale
lincom t4 + t4Xmale
test t2=t3
test t2=t4
test t3=t4
test t2+t2Xmale=t3+t3Xmale
test t2+t2Xmale=t4+t4Xmale
test t3+t3Xmale=t4+t4Xmale

********************************************************************************
* Name			: Table A.5 - Heterogeneity in education level differences, number
*                 of children, wife's employment and decision-making
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

reg dist_child educ_diff t2 t3 t4 t2Xeduc t3Xeduc t4Xeduc $bg_child $bg_parent $diff_parent i.session, robust
reg dist_child child_tot t2 t3 t4 t2Xchild t3Xchild t4Xchild $bg_child $bg_parent $diff_parent i.session, robust
reg dist_child unemp1 t2 t3 t4 t2Xunemp t3Xunemp t4Xunemp $bg_child $bg_parent $diff_parent i.session, robust
reg dist_child power_educ_involved1 t2 t3 t4 t2Xdmeduc t3Xdmeduc t4Xdmeduc $bg_child $bg_parent $diff_parent i.session, robust
reg dist_child power_educ_involved0 t2 t3 t4 t2Xdmeduc2 t3Xdmeduc2 t4Xdmeduc2 $bg_child $bg_parent $diff_parent i.session, robust
reg dist_child power_factor1 t2 t3 t4 t2Xdmfactor t3Xdmfactor t4Xdmfactor $bg_child $bg_parent $diff_parent i.session, robust
reg dist_child power_factor0 t2 t3 t4 t2Xdmfactor2 t3Xdmfactor2 t4Xdmfactor2 $bg_child $bg_parent $diff_parent i.session, robust


********************************************************************************
* Name			: Table B.1 - Effect of increasing the wife's bargaining power
*                 on the allocation to the child, final share
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

*Column (1)
reg final_child t2 t3 t4, robust
test t2=t3
test t3=t4
test t2=t4

*Column (2)
reg final_child t2 t3 t4 i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (3)
reg final_child t2 t3 t4 $bg_child i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (4)
reg final_child t2 t3 t4 $bg_child $bg_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (5)
reg final_child t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

********************************************************************************
* Name			: Table B.2 - Effect of increasing the wife's bargaining power
*                 on the allocation to the child, seemingly unrelated regressions
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

sureg (dist_child  t2 t3 t4 $bg_child $bg_parent $diff_parent i.session) (dist_wife t2 t3 t4 $bg_child $bg_parent $diff_parent i.session) 
test [dist_child]t2=[dist_child]t3
test [dist_wife]t2 = [dist_wife]t3
test [dist_child]t2=[dist_child]t4
test [dist_wife]t2 = [dist_wife]t4
test [dist_child]t4=[dist_child]t3
test [dist_wife]t4 = [dist_wife]t3

********************************************************************************
* Name			: Table B.3 - Effect of increasing the wife's bargaining power
*                 on the allocation to the child, interval censored Tobit
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

gen dist = round(dist_child, 0.1)
gen dist1_2 = dist -0.05 if dist >0
replace dist1_2 = 0 if dist1_2== .
gen dist2_2 = dist + 0.049 if dist <1
replace dist2_2 = 1 if dist2_2 == .

*Column (1)
intreg dist1_2 dist2_2 t2 t3 t4, robust
test t2=t3
test t3=t4
test t2=t4

*Column (2)
intreg dist1_2 dist2_2 t2 t3 t4 i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (3)
intreg dist1_2 dist2_2 t2 t3 t4 $bg_child i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (4)
intreg dist1_2 dist2_2 t2 t3 t4 $bg_child $bg_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (5)
intreg dist1_2 dist2_2 t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

********************************************************************************
* Name			: Table B.4 - Effect of increasing the wife's bargaining power
*                 on the allocation to the child, controlling for outcome in the
*				  preference tasks
* Description	: This dofile shows the code used for each column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

reg dist_child t2 t3 t4 winner_decmaker  $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

reg dist_child t2 t3 t4 winner_am $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

reg dist_child t2 t3 t4 total_am $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

********************************************************************************
* Name			: Table B.5 - Effect of increasing the wife's bargaining power on
*				  the allocation to the wife and the husband, with final share
* Description	: This dofile shows the code used for each Column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 ///
risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk

*Column (1)
reg final_wife t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

*Column (2)
reg final_husband t2 t3 t4 $bg_child $bg_parent $diff_parent i.session, robust
test t2=t3
test t3=t4
test t2=t4

********************************************************************************
* Name			: Table B.6 - Heterogeneity in time- and risk preference difference,
*				  alternative definitions
* Description	: This dofile shows the code used for each Column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_child_nogender std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 risk_invest_share0 risk_invest_share1
global diff_parent_notime educ_diff risk
global diff_parent_norisk educ_diff time 

reg dist_child time2 t2 t3 t4 t2Xtime2 t3Xtime2 t4Xtime2 $bg_child $bg_parent $diff_parent_notime i.session, robust
reg dist_child risk2 t2 t3 t4 t2Xrisk2 t3Xrisk2 t4Xrisk2 $bg_child $bg_parent $diff_parent_norisk i.session, robust
reg dist_child time3 t2 t3 t4 t2Xtime3 t3Xtime3 t4Xtime3 $bg_child $bg_parent $diff_parent_notime i.session, robust
reg dist_child risk3 t2 t3 t4 t2Xrisk3 t3Xrisk3 t4Xrisk3 $bg_child $bg_parent $diff_parent_norisk i.session, robust

********************************************************************************
* Name			: Table B.7 - Heterogeneity in time- and risk preference difference,
*				  and gender of child, with final share
* Description	: This dofile shows the code used for each Column
********************************************************************************
use dataset_wide_appendix.dta, clear

global bg_child gender_child_chosen std_child_chosen child_tot school2 school3 school4
global bg_child_nogender std_child_chosen child_tot school2 school3 school4
global bg_parent age0 age1 selfemp0 selfemp1 educ0 educ1 time_3weeks_share0 time_3weeks_share1 risk_invest_share0 risk_invest_share1
global diff_parent educ_diff time risk
global diff_parent_notime educ_diff risk
global diff_parent_norisk educ_diff time 

reg final_child time t2 t3 t4 t2Xtime t3Xtime t4Xtime $bg_child $bg_parent $diff_parent_notime i.session, robust
reg final_child risk t2 t3 t4 t2Xrisk t3Xrisk t4Xrisk $bg_child $bg_parent $diff_parent_norisk i.session, robust
reg final_child gender_child_chosen t2 t3 t4 t2Xmale t3Xmale t4Xmale $bg_child_nogender $bg_parent $diff_parent i.session, robust
